package com.example.everying.context;/*
 * 项目名称: everything
 * 文件名: UserContext
 * 作者: 张泽阳
 * 日期: 2025/5/16
 * 描述:
 */

import com.example.everying.model.entity.user.UserEntity;
import com.example.everying.model.vo.user.UserInfoVo;

public class UserContext {
    private static final ThreadLocal<UserInfoVo> userHolder = new ThreadLocal<>();

    public static void setUser(UserInfoVo user) {
        userHolder.set(user);
    }

    public static UserInfoVo getUser() {
        return userHolder.get();
    }

    public static void clear() {
        userHolder.remove();
    }
}
